package com.geezdata.cps.base.shiro;

import org.apache.shiro.cache.Cache;
import org.apache.shiro.cache.CacheException;
import org.apache.shiro.cache.CacheManager;
import org.springframework.data.redis.core.RedisTemplate;


public class ShiroCacheManager implements CacheManager {
	private RedisTemplate<Object, Object> redisTemplate;
    
    public ShiroCacheManager(RedisTemplate<Object, Object> redisTemplate) {
		this.redisTemplate = redisTemplate;
    }

    @Override
    public <K, V> Cache<K, V> getCache(String name) throws CacheException {
        return new ShiroCache<K, V>(name, redisTemplate);
    }
}